package com.huiqiao.lesson7.proxy.cglibProxy;

import net.sf.cglib.proxy.MethodInterceptor;
import net.sf.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

/**
 * 实现房东类方法拦截器
 */
public class LandlordMethodInterceptor implements MethodInterceptor {

    @Override
    public Object intercept(Object o, Method method, Object[] objects, MethodProxy methodProxy) throws Throwable {
        System.out.println("代理类开始执行chargeRent方法");
        Object result = methodProxy.invokeSuper(o, objects);
        System.out.println("代理类执行chargeRent方法结束");
        return result;
    }
}
